.navbar__search {
  position: relative;
  margin-left: 16px;
}

.navbar__search-input {
  width: 200px;
  padding: 6px 12px;
  border: 1px solid var(--ifm-color-emphasis-300);
  border-radius: 4px;
  background-color: var(--ifm-background-color);
  color: var(--ifm-font-color-base);
  font-size: 14px;
  transition: width 0.2s ease, border-color 0.2s ease;
}

.navbar__search-input:focus {
  width: 240px;
  outline: none;
  border-color: var(--ifm-color-primary);
}

.navbar__search-input::placeholder {
  color: var(--ifm-color-emphasis-600);
}

.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background-color: var(--ifm-background-surface-color);
  border: 1px solid var(--ifm-color-emphasis-300);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
  z-index: 999;
  min-width: 300px;
}

[data-theme='dark'] .search-results {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.search-result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--ifm-color-emphasis-200);
  transition: background-color 0.2s ease;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: var(--ifm-color-emphasis-100);
}

.search-result-title {
  font-weight: 600;
  color: var(--ifm-font-color-base);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-result-package {
  font-size: 12px;
  color: var(--ifm-color-primary);
  font-weight: 500;
}

.search-result-external {
  font-size: 12px;
  color: var(--ifm-color-emphasis-600);
}

.search-result-content {
  font-size: 13px;
  color: var(--ifm-color-emphasis-700);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-content mark {
  background-color: var(--ifm-color-warning-lightest);
  color: var(--ifm-font-color-base);
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

[data-theme='dark'] .search-result-content mark {
  background-color: var(--ifm-color-warning-darkest);
}

.search-no-results {
  padding: 16px;
  text-align: center;
  color: var(--ifm-color-emphasis-600);
  font-size: 14px;
}

/* Mobile styles */
@media (max-width: 996px) {
  .navbar__search {
    margin-left: 8px;
  }

  .navbar__search-input {
    width: 150px;
  }

  .navbar__search-input:focus {
    width: 180px;
  }

  .search-results {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    max-width: calc(100vw - 16px);
  }
}